{% extends 'base.html' %}

{% block title %}
    已选课程
{% endblock %}

{% block content %}
    <div class="main">
        <div class="row">
            {% for course in courses %}
            <div class="col-md-4">
                <div class="card mb-4 shadow-sm">
                    <img src="{{ MEDIA_URL }}{{ course.css_image }}" alt="课程封面" class="bd-placeholder-img card-img-top" width="100%" height="225">
                    <div class="card-body">
                        <p class="card-text">课程名称：{{ course.css_name }}</p>
                        <p class="card-text">已选人数：{{ course.css_num }}</p>
                        <p class="card-text">可选人数：{{ course.css_max_num }}</p>
                        <p class="card-text">授课老师：{{ course.css_teacher }}</p>
                        <p class="card-text">截止时间：{{ course.css_end_time }}</p>
                        <div class="d-flex justify-content-between align-items-center">
                        <div class="btn-group">
                            <button type="button" class="btn btn-sm btn-outline-danger" onclick="window.location.href='/courses/course_delete/{{ course.pk }}'">取消</button>
                            <button type="button" class="btn btn-sm btn-outline-primary" onclick="window.location.href='/courses/course_detail/{{ course.pk }}'">详情</button>
                        </div>
                        <small class="text-muted"></small>
                        </div>
                    </div>
                </div>
            </div>
            {% endfor %}
        </div>
    </div>
{% endblock %}